package com.zy.design.pattern.observer.syn;

import com.zy.design.pattern.observer.face.IObserver;
import com.zy.design.pattern.observer.face.Message;

/**
 * @author zhaoyi
 * @date 2021/4/25 14:19
 * 观察到用户登录
 * 按规则发放优惠券
 */
public class DiscountObserver implements IObserver {
    @Override
    public void handMessage(Message message) {
        long id = message.getId();
        if (id % 2 == 0) {
            System.out.println(message.getId() + "发放优惠群");
        }else {
            System.out.println(message.getId() + "!!不满足资格,不发放优惠群");
        }

    }
}
